package master.ghrm.domain;

import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class TextualQuestion extends Question {

	private static final long serialVersionUID = 1L;

	private static final String[] EXCL_ADDITIONAL = {};

	@Column(name = "short_answer")
	private Boolean shortAnswer;

	/**
	 * Default constructor, persistence use.
	 */
	public TextualQuestion() {
		super();
		this.shortAnswer = Boolean.TRUE;
	}

	/**
	 * Full constructor.
	 * 
	 * @param name name of the question
	 * @param text text of the question
	 * @param shortAnswered if answer should be short
	 */
	public TextualQuestion(String name, String text, Boolean shortAnswered) {
		super(name, text);
		this.shortAnswer = shortAnswered;
	}

	/**
	 * Copy constructor.
	 * 
	 * @param question question to copy properties from.
	 * @param shortAnswered is short answer.
	 */
	public TextualQuestion(Question question, Boolean shortAnswered) {
		this.setQuestionId(question.getQuestionId());
		this.setName(question.getName());
		this.setText(question.getText());
		this.setQuestionType(question.getQuestionType());
		this.setMustBeAnswered(question.getMustBeAnswered());
		this.setEvalCategory(question.getEvalCategory());
		this.shortAnswer = shortAnswered;
	}

	/**
	 * @return the shortAnswer
	 */
	public Boolean getShortAnswer() {
		return this.shortAnswer;
	}

	/**
	 * @param hasShortAnswer if answer should be rendereds as short
	 */
	public void setShortAnswer(Boolean hasShortAnswer) {
		this.shortAnswer = hasShortAnswer;
	}

	@Override
	protected String[] getAdditionalExclAttr() {
		return EXCL_ADDITIONAL;
	}
}
